package com.flower.hooc.app.api.controller;

import com.flower.hooc.bean.pojo.vo.RespResult;

/**
 * 父类
 *
 * @author:kevinfoo
 * @date:2020/08/27
 * @file:com.flower.controller
 */
public class BaseController {

    /**
     * 请求处理成功，返回业务数据
     *
     * @param data
     * @return
     */
    RespResult returnRespWithSuccess(Object data) {
        RespResult respResult = new RespResult();
        respResult.setCode(RespResult.Code.SUCCESS.getValue());
        respResult.setData(data);
        return respResult;
    }

    /**
     * 请求处理失败，返回提示信息
     *
     * @param data
     * @return
     */
    RespResult returnRespWithFailed(Object data) {
        RespResult respResult = new RespResult();
        respResult.setCode(RespResult.Code.FAILED.getValue());
        respResult.setData(data);
        return respResult;
    }

}
